﻿#include "base_object.h"

namespace nsshare
{
namespace base
{

BaseObject::BaseObject()
{
}

BaseObject::BaseObject(const BaseObject & obj)
{
}

BaseObject::BaseObject(const char * tag)
{
}

void BaseObject::operator=(const BaseObject & obj)
{
}


//////////////////////////////////////////////////////////////////////////////

RefCountObject::RefCountObject()
    :ref_count_(1)
{
}

RefCountObject::RefCountObject(const char * tag)
    :ref_count_(1)
{
}


RefCountObject::~RefCountObject()
{
}

int RefCountObject::IncRef()
{
    return ++ref_count_;
}

int RefCountObject::DecRef()
{
    int decreased_value = --ref_count_;
    if(decreased_value == 0)
        this->Dispose();
    return decreased_value;
}

void RefCountObject::Dispose()
{
    delete this;
}

}
}